/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.mto.module.karaoke.service.impl;

import java.util.List;

import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.mto.module.karaoke.model.Song;
import com.mto.module.karaoke.service.base.SongServiceBaseImpl;

/**
 * The implementation of the song remote service.
 *
 * <p>
 * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link com.mto.module.karaoke.service.SongService} interface.
 *
 * <p>
 * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
 * </p>
 *
 * @author vuonglm
 * @see com.mto.module.karaoke.service.base.SongServiceBaseImpl
 * @see com.mto.module.karaoke.service.SongServiceUtil
 */
public class SongServiceImpl extends SongServiceBaseImpl {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never reference this interface directly. Always use {@link com.mto.module.karaoke.service.SongServiceUtil} to access the song remote service.
	 */
	
	public List<Song> search(Song song, int start, int end, String orderByCol, String orderByType) {
		/**
		 * check permission here if you want
		 */
		return songLocalService.search(song, start, end, orderByCol, orderByType);
	}
	
	public Integer searchCount(Song song) {
		return songLocalService.searchCount(song);
	}
	
	public Song getSong(long songId) throws SystemException, PortalException {
		/**
		 * check permission
		 */
		if(getGuestOrUser() == null) throw new SystemException("You need permission to perform this action.");
		Song song = songPersistence.fetchByPrimaryKey(songId);
		return song;
	}
}